# = test.forum.10.rb - Forum , Forum RSS Test
# 
# See LICENSE.txt for licensing details.
#
# == Description
# Here it is verified  RSS content exists 
# 
#
require 'watir'
include Watir
require 'test/unit'
require '../watir.config.rb'
    
	class TC_ForumRss_test < Test::Unit::TestCase
    
    def startup      
      @@ie = Watir::IE.start($SITE_URL)
	  end
	
	  def ie
      if defined? @@ie
        @@ie
      else
        startup
      end
	  end
    
    def test_01_verifyHomeText
        assert(ie.contains_text(/Community Server/))	
    end
      
    def test_02_verifyLoginLinksExist
      if !(ie.link(:text, 'Sign in').exists?)
        ie.goto($SITE_URL + 'logout.aspx')
        ie.refresh
        ie.goto($SITE_URL)
        ie.refresh
      end
	  end
    
    def test_03_navigateToForum
      ie.link(:text, 'Forums').click
      
      assert(ie.link(:text, 'Sample Forum').exists?)
      ie.link(:text, 'Sample Forum').click
    end
    
    def test_04_verifyLinksOnForumPage
      assert(ie.link(:id, /ctl00_TitleBarSearchButton$/).exists?)
      assert(ie.link(:text, 'Sample Forum Post').exists?)
      assert(ie.link(:text, 'Sample Forum Posts').exists?)
    end
    
    def test_05_verifyDropdownListsOnForumPage
      assert(ie.select_list(:id, /ctl00_SortBy$/).exists?)
      assert(ie.select_list(:id, /ctl00_SortOrder$/).exists?)
      assert(ie.select_list(:id, /ctl00_DateFilter$/).exists?)
    end
    
    def test_06_verifyButtonsOnForumPage
      assert(ie.button(:id, /ctl00_ApplyTemp$/).exists?)
    end
    
    def test_07_verifyFieldsOnForumPage
      assert(ie.text_field(:id, /ctl00_TitleBarSearchText$/).exists?)
    end
    
    def test_08_navigateToRssFeed
      assert(ie.image(:id, /ctl10_ctl01_ctl00$/).).exists?)
      ie.image(:id , /ctl10_ctl01_ctl00$/).).click
    end
    
    def test_09_verifyRssContents
      assert(ie.contains_text("What is RSS"))
      assert(ie.contains_text("Sample Forum"))
      assert(ie.contains_text("Published"))
      assert(ie.link(:text, 'Sample Forum Post').exists?)
    end
    
  end